package com.example.service.store;

import com.example.service.store.impl.CardCommodityServiceImpl;
import com.example.service.store.impl.CouponCommodityServiceImpl;
import com.example.service.store.impl.GoodsCommodityServiceImpl;

/**
 * @author ChenXiaoBin
 * on 2020-07-27
 */
public class StoreFactory {
    public ICommodity getCommodityService(Integer commodityType) {
        if (null == commodityType) {
            return null;
        }
        if (1 == commodityType) {
            return new CouponCommodityServiceImpl();
        }
        if (2 == commodityType) {
            return new GoodsCommodityServiceImpl();
        }
        if (3 == commodityType) {
            return new CardCommodityServiceImpl();
        } throw new RuntimeException("不存在的商品服务类型");
    }
}
